package logic

import (
	"fmt"
	"gctl/pkg"
	"os"
	"path/filepath"
)

func BffInit(app string, bff string) {
	//pkg.ChEndFileName("/Users/hyx/work/gowork/gospace/src/gctl/tpl/bff")
	//return
	//遍历srv模板目录
	curPath, _ := os.Getwd()
	//pkg
	pkg.Render(app, "pkg", "pkg")
	//bff
	pkg.Render(app, bff, "bff")
	//config
	pkg.CopyTo(filepath.Join(curPath, "tpl/bff/cmd/apps/config.yaml"), filepath.Join(curPath, app, bff, "/cmd/apps/config.yaml"))
	fmt.Println("config路径 tpl：", filepath.Join(curPath, "tpl/srv/cmd/apps/config.yaml"))
	fmt.Println("config路径 to：", filepath.Join(curPath, app, bff, "/cmd/apps/config.yaml"))
	//gitignore
	pkg.CopyTo(curPath+"/tpl/common/.gitignore", curPath+"/"+app+"/.gitignore")
}
